<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>选择合作商</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../../include/commonFile.jsp" %>
    <style type="text/css">
        .index-outside > section .section-main {
            min-width: 0px !important;
            max-width: 1200px !important;
        }
    </style>
</head>
<body>
<!--头部-->
<div class="index-outside">
    <!--内容-->
    <section class="no-fix">
        <div class="section-main" style="padding: 0px 15px">
            <div class="layui-tab-item layui-show">
                <div class="layui-tab-item layui-show">
                    <div class="layui-tab layui-tab-brief" lay-filter="type">
                        <ul class="layui-tab-title">
                            <li <c:if test="${memberInput.isPartner == 1}">class="layui-this"</c:if> >合作商</li>
                            <li <c:if test="${memberInput.isDistributor == 1}">class="layui-this"</c:if> >分销商</li>
                        </ul>
                        <form class="layui-form" action="${ctx}/system/member/selectMember.do?pageType=1" id="myForm" method="post">
                            <input type="hidden" name="pageNo" id="pageNo"/>
                            <input type="hidden" name="isPartner" value="${memberInput.isPartner}"/>
                            <input type="hidden" name="isDistributor" value="${memberInput.isDistributor}"/>
                            <div class="f-search-bar">
                                <div class="search-container">
                                    <ul class="search-form-content">
                                        <li class="form-item-inline"><label class="search-form-lable">昵称</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="realname" autocomplete="off"
                                                       class="layui-input" value="${memberInput.realname}"
                                                       placeholder="请输入查询昵称">
                                            </div>
                                        </li>
                                        <li class="form-item-inline"><label class="search-form-lable">用户名</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="username" autocomplete="off"
                                                       class="layui-input" value="${memberInput.username}"
                                                       placeholder="请输入查询用户名">
                                            </div>
                                        </li>
                                        <li class="form-item-inline"><label class="search-form-lable">手机</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="mobile" autocomplete="off" class="layui-input"
                                                       value="${memberInput.mobile}" placeholder="请输入查询手机">
                                            </div>
                                        </li>
                                        <li class="form-item-inline">
                                            <div class="sub-btns">
                                                <a class="layui-btn layui-btn-danger" id="submitBtn">确定</a>
                                                <a class="layui-btn layui-btn-normal" id="resetBtn">重置</a>
                                            </div>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </form>
                        <div class="c-time-list-content" style="padding-top: 0px;">
                            <input type="hidden" id="memberId"/>
                            <input type="hidden" id="memberName"/>
                            <input type="hidden" id="logo"/>
                            <ul>
                                <table class="layui-table layui-form">
                                    <colgroup>
                                        <col width="80px">
                                        <col width="200px">
                                        <col width="150px">
                                        <col width="150px">
                                    </colgroup>
                                    <thead>
                                    <tr>
                                        <th></th>
                                        <th>昵称</th>
                                        <th>用户名</th>
                                        <th>手机</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach var="mm" items="${memberList}">
                                        <tr>
                                            <td><input type="radio" name="id" value="${mm.id}"
                                                       data-name="${mm.realname}" data-logo="${mm.logo}"
                                                       lay-filter="member" title="&nbsp;"></td>
                                            <td>${mm.realname}</td>
                                            <td>${mm.username}</td>
                                            <td>${mm.mobile}</td>
                                        </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                            </ul>
                        </div>
                        <div id="page_content" class="page-container"></div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<!--底部-->
<%@include file="../../include/incScript.jsp" %>
<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript">
    $(function () {
        // 加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });
        layui.use(['form', 'element'], function () {
            var form = layui.form, element = layui.element;
            form.on('radio(member)', function (data) {
                $("#memberId").val(data.value);
                $("#memberName").val($(data.elem).attr("data-name"));
                $("#logo").val($(data.elem).attr("data-logo"));
            });
            element.on('tab(type)', function (data) {
                if (data.index == 0) {
                    location.href = "${ctx}/system/member/selectMember.do?isPartner=1&pageType=1";
                } else if (data.index == 1) {
                    location.href = "${ctx}/system/member/selectMember.do?isDistributor=1&pageType=1";
                }
            });
        });
        $("#submitBtn").click(function () {
            $("#myForm").submit();
        });

        $("#resetBtn").click(function () {
            $("#myForm input[type=text]").val("");
            $("#myForm select").find("option:eq(0)").attr("selected", true);
            $(".check-btn-inner").find("a").removeClass("active");
            $(".check-btn-inner").find("a:eq(0)").addClass("active")
            $(".check-btn-inner [name=timeType]").val("");
        });
    });

    function doSubmit(){
        var chkLength = $("[name=id]:checked").length;
        if(chkLength == 0){
            util.layerMsgError("请先选择")
            return false;
        }
        return true;
    }

    function returnData() {
        return {
            id: $('#memberId').val(),
            name: $('#memberName').val(),
            logo: $('#logo').val()
        }
    }
</script>
</body>
</html>